<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Class template unbounded_ordering_queue</title>
<link rel="stylesheet" href="../../../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../../../index.html" title="Chapter 1. Boost.Log v2">
<link rel="up" href="../../../sinks.html#header.boost.log.sinks.unbounded_ordering_queue_hpp" title="Header &lt;boost/log/sinks/unbounded_ordering_queue.hpp&gt;">
<link rel="prev" href="unbounded_fifo_queue.html" title="Class unbounded_fifo_queue">
<link rel="next" href="unlocked_sink.html" title="Class template unlocked_sink">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td></tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="unbounded_fifo_queue.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../../sinks.html#header.boost.log.sinks.unbounded_ordering_queue_hpp"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="unlocked_sink.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="refentry">
<a name="boost.log.sinks.unbounded_ordering_queue"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2><span class="refentrytitle">Class template unbounded_ordering_queue</span></h2>
<p>boost::log::sinks::unbounded_ordering_queue — Unbounded ordering log record queueing strategy. </p>
</div>
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: &lt;<a class="link" href="../../../sinks.html#header.boost.log.sinks.unbounded_ordering_queue_hpp" title="Header &lt;boost/log/sinks/unbounded_ordering_queue.hpp&gt;">boost/log/sinks/unbounded_ordering_queue.hpp</a>&gt;

</span><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> OrderT<span class="special">&gt;</span> 
<span class="keyword">class</span> <a class="link" href="unbounded_ordering_queue.html" title="Class template unbounded_ordering_queue">unbounded_ordering_queue</a> <span class="special">{</span>
<span class="keyword">public</span><span class="special">:</span>
  <span class="comment">// <a class="link" href="unbounded_ordering_queue.html#boost.log.sinks.unbounded_ordering_queueconstruct-copy-destruct">construct/copy/destruct</a></span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> ArgsT<span class="special">&gt;</span> <span class="keyword">explicit</span> <a class="link" href="unbounded_ordering_queue.html#idm45961918302832-bb"><span class="identifier">unbounded_ordering_queue</span></a><span class="special">(</span><span class="identifier">ArgsT</span> <span class="keyword">const</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>

  <span class="comment">// <a class="link" href="unbounded_ordering_queue.html#idm45961918319296-bb">public member functions</a></span>
  <span class="identifier">posix_time</span><span class="special">::</span><span class="identifier">time_duration</span> <a class="link" href="unbounded_ordering_queue.html#idm45961918318736-bb"><span class="identifier">get_ordering_window</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>

  <span class="comment">// <a class="link" href="unbounded_ordering_queue.html#idm45961918316976-bb">public static functions</a></span>
  <span class="keyword">static</span> <span class="identifier">posix_time</span><span class="special">::</span><span class="identifier">time_duration</span> <a class="link" href="unbounded_ordering_queue.html#idm45961918316416-bb"><span class="identifier">get_default_ordering_window</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>

  <span class="comment">// <a class="link" href="unbounded_ordering_queue.html#idm45961918314576-bb">protected member functions</a></span>
  <span class="keyword">void</span> <a class="link" href="unbounded_ordering_queue.html#idm45961918314000-bb"><span class="identifier">enqueue</span></a><span class="special">(</span><span class="identifier">record_view</span> <span class="keyword">const</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">bool</span> <a class="link" href="unbounded_ordering_queue.html#idm45961918312160-bb"><span class="identifier">try_enqueue</span></a><span class="special">(</span><span class="identifier">record_view</span> <span class="keyword">const</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">bool</span> <a class="link" href="unbounded_ordering_queue.html#idm45961918310304-bb"><span class="identifier">try_dequeue_ready</span></a><span class="special">(</span><span class="identifier">record_view</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">bool</span> <a class="link" href="unbounded_ordering_queue.html#idm45961918308368-bb"><span class="identifier">try_dequeue</span></a><span class="special">(</span><span class="identifier">record_view</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">bool</span> <a class="link" href="unbounded_ordering_queue.html#idm45961918306496-bb"><span class="identifier">dequeue_ready</span></a><span class="special">(</span><span class="identifier">record_view</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">void</span> <a class="link" href="unbounded_ordering_queue.html#idm45961918304592-bb"><span class="identifier">interrupt_dequeue</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>

  <span class="comment">// <a class="link" href="unbounded_ordering_queue.html#idm45961918300432-bb">private member functions</a></span>
  <span class="keyword">void</span> <a class="link" href="unbounded_ordering_queue.html#idm45961918299856-bb"><span class="identifier">enqueue_unlocked</span></a><span class="special">(</span><span class="identifier">record_view</span> <span class="keyword">const</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
<span class="special">}</span><span class="special">;</span></pre></div>
<div class="refsect1">
<a name="idm46846454782528"></a><h2>Description</h2>
<p>The <code class="computeroutput"><a class="link" href="unbounded_ordering_queue.html" title="Class template unbounded_ordering_queue">unbounded_ordering_queue</a></code> class is intended to be used with the <code class="computeroutput"><a class="link" href="asynchronous_sink.html" title="Class template asynchronous_sink">asynchronous_sink</a></code> frontend as a log record queueing strategy.</p>
<p>This strategy provides the following properties to the record queueing mechanism:</p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem"><p>The queue has no size limits. </p></li>
<li class="listitem"><p>The queue has a fixed latency window. This means that each log record put into the queue will normally not be dequeued for a certain period of time. </p></li>
<li class="listitem"><p>The queue performs stable record ordering within the latency window. The ordering predicate can be specified in the <code class="computeroutput">OrderT</code> template parameter.</p></li>
</ul></div>
<p>
Since this queue has no size limits, it may grow uncontrollably if sink backends dequeue log records not fast enough. When this is an issue, it is recommended to use one of the bounded strategies. </p>
<div class="refsect2">
<a name="idm46846454775152"></a><h3>
<a name="boost.log.sinks.unbounded_ordering_queueconstruct-copy-destruct"></a><code class="computeroutput">unbounded_ordering_queue</code> 
        public
       construct/copy/destruct</h3>
<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> ArgsT<span class="special">&gt;</span> <span class="keyword">explicit</span> <a name="idm45961918302832-bb"></a><span class="identifier">unbounded_ordering_queue</span><span class="special">(</span><span class="identifier">ArgsT</span> <span class="keyword">const</span> <span class="special">&amp;</span> args<span class="special">)</span><span class="special">;</span></pre>Initializing constructor. </li></ol></div>
</div>
<div class="refsect2">
<a name="idm46846454763728"></a><h3>
<a name="idm45961918319296-bb"></a><code class="computeroutput">unbounded_ordering_queue</code> public member functions</h3>
<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
<pre class="literallayout"><span class="identifier">posix_time</span><span class="special">::</span><span class="identifier">time_duration</span> <a name="idm45961918318736-bb"></a><span class="identifier">get_ordering_window</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>
<p>Returns ordering window size specified during initialization </p>
</li></ol></div>
</div>
<div class="refsect2">
<a name="idm46846454755200"></a><h3>
<a name="idm45961918316976-bb"></a><code class="computeroutput">unbounded_ordering_queue</code> public static functions</h3>
<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
<pre class="literallayout"><span class="keyword">static</span> <span class="identifier">posix_time</span><span class="special">::</span><span class="identifier">time_duration</span> <a name="idm45961918316416-bb"></a><span class="identifier">get_default_ordering_window</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>
<p>Returns default ordering window size. The default window size is specific to the operating system thread scheduling mechanism. </p>
</li></ol></div>
</div>
<div class="refsect2">
<a name="idm46846454746448"></a><h3>
<a name="idm45961918314576-bb"></a><code class="computeroutput">unbounded_ordering_queue</code> protected member functions</h3>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
<pre class="literallayout"><span class="keyword">void</span> <a name="idm45961918314000-bb"></a><span class="identifier">enqueue</span><span class="special">(</span><span class="identifier">record_view</span> <span class="keyword">const</span> <span class="special">&amp;</span> rec<span class="special">)</span><span class="special">;</span></pre>Enqueues log record to the queue. </li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">bool</span> <a name="idm45961918312160-bb"></a><span class="identifier">try_enqueue</span><span class="special">(</span><span class="identifier">record_view</span> <span class="keyword">const</span> <span class="special">&amp;</span> rec<span class="special">)</span><span class="special">;</span></pre>Attempts to enqueue log record to the queue. </li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">bool</span> <a name="idm45961918310304-bb"></a><span class="identifier">try_dequeue_ready</span><span class="special">(</span><span class="identifier">record_view</span> <span class="special">&amp;</span> rec<span class="special">)</span><span class="special">;</span></pre>Attempts to dequeue a log record ready for processing from the queue, does not block if no log records are ready to be processed. </li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">bool</span> <a name="idm45961918308368-bb"></a><span class="identifier">try_dequeue</span><span class="special">(</span><span class="identifier">record_view</span> <span class="special">&amp;</span> rec<span class="special">)</span><span class="special">;</span></pre>Attempts to dequeue log record from the queue, does not block. </li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">bool</span> <a name="idm45961918306496-bb"></a><span class="identifier">dequeue_ready</span><span class="special">(</span><span class="identifier">record_view</span> <span class="special">&amp;</span> rec<span class="special">)</span><span class="special">;</span></pre>Dequeues log record from the queue, blocks if no log records are ready to be processed. </li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">void</span> <a name="idm45961918304592-bb"></a><span class="identifier">interrupt_dequeue</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>Wakes a thread possibly blocked in the <code class="computeroutput">dequeue</code> method. </li>
</ol></div>
</div>
<div class="refsect2">
<a name="idm46846454707952"></a><h3>
<a name="idm45961918300432-bb"></a><code class="computeroutput">unbounded_ordering_queue</code> private member functions</h3>
<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
<pre class="literallayout"><span class="keyword">void</span> <a name="idm45961918299856-bb"></a><span class="identifier">enqueue_unlocked</span><span class="special">(</span><span class="identifier">record_view</span> <span class="keyword">const</span> <span class="special">&amp;</span> rec<span class="special">)</span><span class="special">;</span></pre>Enqueues a log record. </li></ol></div>
</div>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2007-2021 Andrey Semashev<p>
        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>).
      </p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="unbounded_fifo_queue.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../../sinks.html#header.boost.log.sinks.unbounded_ordering_queue_hpp"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="unlocked_sink.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
